/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package egresados_final;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author murrieta
 */
@Entity
@Table(name = "sexo")
@NamedQueries({@NamedQuery(name = "Sexo.findAll", query = "SELECT s FROM Sexo s"), @NamedQuery(name = "Sexo.findBySexoId", query = "SELECT s FROM Sexo s WHERE s.sexoId = :sexoId"), @NamedQuery(name = "Sexo.findBySexo", query = "SELECT s FROM Sexo s WHERE s.sexo = :sexo")})
public class Sexo implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "SEXO_ID")
    private Integer sexoId;
    @Column(name = "SEXO")
    private String sexo;
    @OneToMany(mappedBy = "sexoId")
    private List<Generales> generalesCollection;

    public Sexo() {
    }

    public Sexo(Integer sexoId) {
        this.sexoId = sexoId;
    }

    public Integer getSexoId() {
        return sexoId;
    }

    public void setSexoId(Integer sexoId) {
        Integer oldSexoId = this.sexoId;
        this.sexoId = sexoId;
        changeSupport.firePropertyChange("sexoId", oldSexoId, sexoId);
    }

    public String getSexo() {
        return sexo;
    }

    public void setSexo(String sexo) {
        String oldSexo = this.sexo;
        this.sexo = sexo;
        changeSupport.firePropertyChange("sexo", oldSexo, sexo);
    }

    public List<Generales> getGeneralesCollection() {
        return generalesCollection;
    }

    public void setGeneralesCollection(List<Generales> generalesCollection) {
        this.generalesCollection = generalesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sexoId != null ? sexoId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sexo)) {
            return false;
        }
        Sexo other = (Sexo) object;
        if ((this.sexoId == null && other.sexoId != null) || (this.sexoId != null && !this.sexoId.equals(other.sexoId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "egresados_final.Sexo[sexoId=" + sexoId + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
